package controller;

import com.simple.rpc.annotation.RpcReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import service.GreetingService;

/**
 * @author mhh
 * @since 2020/9/17
 */
@RestController
public class HelloController {

    @RpcReference
    private GreetingService greetingService;

    @GetMapping(value = "/hello")
    public String sayHello(@RequestParam("name") String name) {
        String greeting = greetingService.sayHello(name);
        return greeting == null ? "default greeting" : greeting;
    }
}
